package yt.kpool.adapter;

import android.content.ClipboardManager;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.king.base.adapter.ViewHolderAdapter;
import com.king.base.adapter.holder.ViewHolder;

import java.util.List;

import yt.kpool.R;
import yt.kpool.bean.AddMinerRemarkBean;
import yt.kpool.bean.CurrencyList;
import yt.kpool.network.NetHelperNew;
import yt.kpool.util.ToastUtil;
import yt.kpool.util.imageUtil.GlideUtil;

import static android.content.Context.CLIPBOARD_SERVICE;

/**
 * 矿工添加方法下部列表
 * Created by Administrator on 2017/8/7.
 */

public class AddMinerBottomListAdapter extends ViewHolderAdapter<AddMinerRemarkBean.DataBean.MinerSetupBean> {

    public AddMinerBottomListAdapter(Context context, List<AddMinerRemarkBean.DataBean.MinerSetupBean> listData) {
        super(context, listData);
    }

    @Override
    public View buildConvertView(LayoutInflater layoutInflater, AddMinerRemarkBean.DataBean.MinerSetupBean currencyListBean, int position) {
        return layoutInflater.inflate(R.layout.item_addminer_bottom_layout,null);
    }

    @Override
    public void bindViewDatas(ViewHolder holder, final AddMinerRemarkBean.DataBean.MinerSetupBean currencyListBean, int position) {
        //holder.setText(R.id.text,currencyListBean.getCode());
        holder.setText(R.id.tv_title,currencyListBean.getTitle());
        holder.setText(R.id.tv_content,currencyListBean.getContent());

          if (currencyListBean.isIsCopy())
          {
              holder.getView(R.id.iv_copy).setVisibility(View.VISIBLE);
          }else
          {  holder.getView(R.id.iv_copy).setVisibility(View.GONE);

          }
        holder.getView(R.id.iv_copy).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ClipboardManager cmb2 = (ClipboardManager)context.getSystemService(CLIPBOARD_SERVICE);
                cmb2.setText(currencyListBean.getContent());
                ToastUtil.showToast(context,"已复制到剪贴板");
            }
        });
    }
}
